//  Copyright (c) 2013年 mafengwo All rights reserved.
//  Created by hanfeng on 12-11-29.

#import <UIKit/UIKit.h>
#import <AssetsLibrary/AssetsLibrary.h>

@interface UIImage (Addition)

+ (BOOL)isAnimatedGifImageWithImageData:(NSData*)imageData;
+ (BOOL)isGifImageWithImageData:(NSData*)imageData;
+ (BOOL)isGifImageWithFilePath:(NSString *)filePath;

+ (UIImage*)imageFromColor:(UIColor*)color withSize:(CGSize)size;

- (UIImage*)centeredImageWithSize:(CGSize)size stretch:(BOOL)stretch;
- (UIImage*)centeredImageWithSize:(CGSize)newSize withOffset:(CGPoint)offset stretch:(BOOL)stretch;

+ (UIImage *)imageWithContentsOfResolutionIndependentFile:(NSString *)path;
- (id)initWithContentsOfResolutionIndependentFile:(NSString *)path;

- (UIImage *)imageWithBackgroundImage:(UIImage *)backgroundImage;

- (UIImage *)croppedImageWithRelativeFrame:(CGRect)frame; // relative: 0.0 - 1.0
- (UIImage *)croppedImageWithRelativeFrame:(CGRect)frame fillInSize:(CGSize)fillSize;

#pragma mark - Blur Effect
- (UIImage *)imageToApplyBlurWithRadius:(CGFloat)blurRadius insetWidth:(CGFloat)insetWidth;
- (UIImage *)blurryImage:(float)boxBlur;

#pragma mark - Image Resize
+ (CGSize)stretchSize:(CGSize)thisSize withSize:(CGSize)aSize;
+ (CGSize)fitSize:(CGSize)thisSize inSize:(CGSize)aSize;

- (UIImage *)imageWithFitSize:(CGSize)size;

+ (CGSize)fitSize:(CGSize)thisSize forWidth:(CGFloat)width;
+ (CGSize)fitSize:(CGSize)thisSize forHeight:(CGFloat)height;

- (UIImage *)imageWithFitWidth:(CGFloat)width;
- (UIImage *)imageWithFitHeight:(CGFloat)height;

- (UIImage *)imageWithRotatedDegrees:(CGFloat)degrees;

#pragma mark - AssetLibrary

+ (UIImage *)fullSizeImageForAssetRepresentation:(ALAssetRepresentation *)assetRepresentation;
-(UIImage *)scaleToWidth:(CGFloat)width;

@end
